﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Content;

namespace Syngine.Content
{
	/// <summary>
	/// 
	/// </summary>
	public class AsyncContentManager : ContentManager
	{
		private readonly IList<string> _queue = new List<string>();

		/// <summary>
		/// Initializes a new instance of the <see cref="AsyncContentManager"/> class.
		/// </summary>
		/// <param name="serviceProvider">The service provider.</param>
		public AsyncContentManager(IServiceProvider serviceProvider) : base(serviceProvider)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="AsyncContentManager"/> class.
		/// </summary>
		/// <param name="serviceProvider">The service provider.</param>
		/// <param name="rootDirectory">The root directory.</param>
		public AsyncContentManager(IServiceProvider serviceProvider, string rootDirectory) : base(serviceProvider, rootDirectory)
		{
		}

		/// <summary>
		/// Enqueues the specified asset name for loading.
		/// </summary>
		/// <param name="assetName">Name of the asset.</param>
		public void Enqueue(string assetName)
		{
			_queue.Add(assetName);
		}

		/// <summary>
		/// Loads the queue asynchronously.
		/// </summary>
		public void LoadAsync()
		{
			//_queue.AsParallel().WithDegreeOfParallelism(Environment.ProcessorCount * 2).ForAll(s =>
			//{

			//});
		}

		/// <summary>
		/// Loads the queue asynchronously.
		/// </summary>
		public void LoadAsync(string assetName)
		{

		}
	}
}